import HttpUtil from '@/common/HttpUtil'

const geographicApi = {

  /**
   * 获取图层组和图层的树结构数据
   */
  findMapLayerSource (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/gis/layer/findLayerGroupInfo'
    return HttpUtil.post(postUrl, params)
  },
  /**
   * 根据图层获取Feature要素
   */
  findFeatureByLayer (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/gis/geoMap/findFeatureByLayer'
    return HttpUtil.postJSON(postUrl, params)
  },
  /**
   * 获取图层组json
   * @returns {*|void}
   */
  findAll (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/gis/layerGroup/findAll'
    return HttpUtil.get(postUrl, params)
  },
  /**
   * 获取图层组list
   * @returns {*|void}
   */
  findList (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/gis/layerGroup/findList'
    return HttpUtil.get(postUrl, params)
  },
  /**
   * 添加图层组
   */
  addLayerGroup (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/gis/layerGroup/add'
    return HttpUtil.postJSON(postUrl, params)
  },
  /**
   * 删除图层组
   */
  deleteLayerGroup (id) {
    let postUrl = process.env.SURVEY_DOMAIN + '/gis/layerGroup/delete/' + id
    return HttpUtil.delete(postUrl, null)
  },

  /**
   * 获取图层列表分页
   */
  findLayerPage (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/gis/layer/findPage'
    return HttpUtil.postJSON(postUrl, params)
  },
  /**
   * 添加图层
   */
  addLayer (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/gis/layer/add'
    return HttpUtil.postJSON(postUrl, params)
  },
  /**
   * 更新图层信息
   */
  updateLayer (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/gis/layer/update'
    return HttpUtil.putJSON(postUrl, params)
  },
  /**
   * 删除图层
   */
  deleteLayer (id) {
    let postUrl = process.env.SURVEY_DOMAIN + '/gis/layer/delete/' + id
    return HttpUtil.delete(postUrl, null)
  },
  /**
   *获取单个图层信息
   */
  getLayer (id) {
    let getUrl = process.env.SURVEY_DOMAIN + '/gis/layer/getInfo/' + id
    return HttpUtil.get(getUrl, null)
  }
}
export default geographicApi
